// 屏幕缩放
export function screenSize(editorDom) {
  // 获取当前屏幕的宽度/高度
  let screenWidth =
    document.body.clientWidth || document.documentElement.clientWidth
  let screenHeight =
    document.body.clientHeight || document.documentElement.clientHeight
  // 默认屏幕宽度为 1920*1080
  let defWidth = 1920
  let defHeight = 1080
  // 获取比例
  let xScale = screenWidth / defWidth
  let yScale = screenHeight / defHeight
  // 使用transform缩放
  editorDom.style.cssText += ';transform: scale(' + xScale + ',' + yScale + ')'

  // 当浏览器缩放时
  // $(window).resize(() => {
  //   let screenWidth =
  //     document.body.clientWidth || document.documentElement.clientWidth
  //   let screenHeight =
  //     document.body.clientHeight || document.documentElement.clientHeight
  //   xScale = screenWidth / defWidth
  //   yScale = screenHeight / defHeight
  //   editorDom.style.cssText +=
  //     ';transform: scale(' + xScale + ',' + yScale + ')'
  // })
  window.addEventListener('resize', () => {
    let screenWidth =
      document.body.clientWidth || document.documentElement.clientWidth
    let screenHeight =
      document.body.clientHeight || document.documentElement.clientHeight
    xScale = screenWidth / defWidth
    yScale = screenHeight / defHeight
    editorDom.style.cssText +=
      ';transform: scale(' + xScale + ',' + yScale + ')'
  })
}
